import { BookReservationForm, Reservation, ReservationStatus } from '@/types/reservation';
import request from '@/utils/request';

const baseURL = '/reservation';

export const query = (date: Date | string, status: ReservationStatus): Promise<Reservation[]> => {
	return request.get(baseURL, { params: { date, status } });
};

export const detail = (id: string): Promise<Reservation> => {
	return request.get(`${baseURL}/${id}`);
};

export const book = (data: BookReservationForm): Promise<Reservation> => {
	return request.post(baseURL, data);
};

export const update = (data: BookReservationForm, id: string): Promise<Reservation> => {
	return request.put(`${baseURL}/${id}`, data);
};

export const cancel = (id: string): Promise<Reservation> => {
	return request.put(`${baseURL}/cancel/${id}`);
};

export const mark = (id: string, status: ReservationStatus): Promise<Reservation> => {
	return request.put(`${baseURL}/${id}`, status);
};
